#define _CRT_SECURE_NO_WARNINGS 1
#include "sort.h"
void init(st* p)
{
	assert(p);
	p->size = 0;
	p->ps = NULL;
	int* tem = (int*)realloc(p->ps, sizeof(int) * 2);
	assert(tem);
	p->ps = tem;
	p->capacity = 2;
}
void push(st* p, int x)
{
	assert(p);
	if (p->capacity == p->size)
	{
		int* tem = (int*)realloc(p->ps, sizeof(int) * 2 * p->capacity);
		assert(tem);
		p->ps = tem;
		p->capacity = 2 * p->capacity;
	}
	p->ps[p->size++] = x;
}
void pop(st* p)
{
	assert(p);
	p->size--;
}
int take(st* p)
{
	assert(p);
	return p->ps[p->size - 1];
}
int stackempty(st* p)
{
	assert(p);
	if (p->size == 0)
		return 0;
	else
		return 1;
}